Geospatial Data &
Home Insurance Territories
(With R)

Kevin McBeth, FCAS, MAAA

Introduction

Presenter

Kevin McBeth, FCAS, MAAA

Vice President - Corporate Actuarial

Arch Insurance

New York, NY

Disclaimers

  • Some references to vendors. This is neither a comprehensive list nor an endorsement of specific vendors

  • The views and opinions expressed in this presentation are my own and do not necessarily reflect those of my current or former employers. The views are my own understanding and interpretation of publicly available filings.

  • I am not a licensed insurance agent, broker, or claims handler. The information I share is for general informational purposes only and should not be interpreted as insurance advice, a recommendation of coverage, or guidance on claims. For personalized assistance, please consult a licensed insurance professional or claims representative.

  • I am not an attorney. Comments about state statutes should not be treated as legal advice provided by a licensed attorney

  • Artistic interpretation of data contained in filings.

Slides

www.actuarialhero.com

Outline

  • Tech Stack
  • Types of Geospatial Data
  • Geocoding
  • Vector Data Sources
  • Raster Data Sources
  • Modeling the Cost of Home Insurance
  • Example Territory Maps
  • Considerations
    • ZIP Codes
    • Hawaii
    • Alaska
  • Location-specific Data
  • Conclusion

Tech Stack

  • R
    • renv for the environment
    • air for code formatting
  • RStudio - IDE from Posit (formerly named RStudio)
  • Positron - VSCode-based IDE from Posit
  • Quarto - Presentation + code together
  • GitHub - Source code control
  • GitHub Pages - Publishing the rendered presentation online (automatically!)

Vector Sources

Vector File Types

  • Shapefile (.shp)
  • GeoJSON (.geojson, .json) Keyhole Markup Language (KML, KMZ)
  • Geography Markup Language (GML)
  • GPS eXchange Format (GPX)

Census Bureau Shapefiles

  • States
  • Counties
  • Cities
  • ZIP Codes
  • Tract
  • Block Group
  • Blocks

States

Download Shapefiles
library(curl)

url <- "https://www2.census.gov/geo/tiger/TIGER2025/STATE/tl_2025_us_state.zip"
dest_in <- "./data_in/census/TIGER2025/STATE/tl_2025_us_state.zip"
dest_mid <- "./data_mid/census/TIGER2025/STATE/tl_2025_us_state/tl_2025_us_state.zip"

if(!file.exists(dest_in)) {
  dir.create(dirname(dest_in), recursive = TRUE, showWarnings = FALSE)
  curl_download(url, dest_in)
  
  dir.create(dirname(dest_mid), recursive = TRUE, showWarnings = FALSE)
  unzip(dest_in, exdir = dirname(dest_mid))
}

dest_mid
Show code
library(sf)
library(dplyr)

# Read Census State Shapefile
census_state  <- read_sf("./data_mid/census/TIGER2025/STATE/tl_2025_us_state/tl_2025_us_state.shp")

# Print data table
census_state %>% arrange(STATEFP)
Simple feature collection with 56 features and 15 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: -179.2311 ymin: -14.60181 xmax: 179.8597 ymax: 71.43979
Geodetic CRS:  NAD83
# A tibble: 56 × 16
   REGION DIVISION STATEFP STATENS  GEOID GEOIDFQ     STUSPS NAME    LSAD  MTFCC
   <chr>  <chr>    <chr>   <chr>    <chr> <chr>       <chr>  <chr>   <chr> <chr>
 1 3      6        01      01779775 01    0400000US01 AL     Alabama 00    G4000
 2 4      9        02      01785533 02    0400000US02 AK     Alaska  00    G4000
 3 4      8        04      01779777 04    0400000US04 AZ     Arizona 00    G4000
 4 3      7        05      00068085 05    0400000US05 AR     Arkans… 00    G4000
 5 4      9        06      01779778 06    0400000US06 CA     Califo… 00    G4000
 6 4      8        08      01779779 08    0400000US08 CO     Colora… 00    G4000
 7 1      1        09      01779780 09    0400000US09 CT     Connec… 00    G4000
 8 3      5        10      01779781 10    0400000US10 DE     Delawa… 00    G4000
 9 3      5        11      01702382 11    0400000US11 DC     Distri… 00    G4000
10 3      5        12      00294478 12    0400000US12 FL     Florida 00    G4000
# ℹ 46 more rows
# ℹ 6 more variables: FUNCSTAT <chr>, ALAND <dbl>, AWATER <dbl>,
#   INTPTLAT <chr>, INTPTLON <chr>, geometry <MULTIPOLYGON [°]>

New York Leaflet Plot

Leaflet Code
library(leaflet)

census_state %>%
  filter(STUSPS == "NY") %>%
  leaflet() %>%
  addPolygons(weight = 0.5, opacity = 1.0)

New York Leaflet Plot With Basemap

Leaflet Code
library(leaflet)

census_state %>%
  filter(STUSPS == "NY") %>%
  leaflet() %>%
  addTiles() %>% # Added OpenStreetMap Basemap
  addPolygons(weight = 0.5, opacity = 1.0)

Entire State Shapefile

Leaflet Code
library(leaflet)

census_state %>%
  leaflet() %>%
  addTiles() %>% # Added OpenStreetMap Basemap
  addPolygons(weight = 0.5, opacity = 1.0)

Grids

  • MGRS
  • Constructing your own

Newer Geometries

  • Spherical: s2 geometry
    • http://s2geometry.io/
    • https://r-spatial.github.io/s2/
  • Hexagonal: h3 geometry
    • https://h3geo.org/
  • Hexagonal (not h3):
    • Alfa Mutual using 2,600 hexagons coverage Alabama.
    • Filing: ALFA-134414286
    • Date Filed: 2025-05-14
    • Date Effective: 2025-08-24

Raster Data Sources

(Slightly Bended Pictures)

National Land Cover Dataset (NLCD)

DEM

Location-specific Data

Where is the propety?

  • Geocoding

    • Lots of providers. Three examples:

      • ESRI ArcGIS: https://developers.arcgis.com/rest/geocode/geocode-addresses/
      • Google Maps: https://developers.google.com/maps/documentation/geocoding/reference/rest/v4beta/GeocodeResult.Granularity
      • mapbox: https://docs.mapbox.com/api/search/geocoding/
    • Single point

    • Mailbox vs. building

    • May not be accurate, particularly for new properties

  • Building Footprints

    • Outline of the entire building
    • https://onegeo.co/documentation/api/
    • https://planetarycomputer.microsoft.com/dataset/ms-buildings#overview
    • https://dataforgood.facebook.com/dfg/tools/buildings